Systems and methods for error correction and decoding on multi-level physical media

ABSTRACT

Apparatus and methods for operating a flash device characterized by use of Lee distance based codes in a flash device so as to increase the number of errors that can be corrected for a given number of redundancy cells, compared with Hamming distance based codes.

REFERENCE TO CO-PENDING APPLICATIONS

Priority is claimed from the following co-pending applications: U.S. Provisional Application No. 61/006,385, filed Jan. 10, 2008 and entitled “A System for Error Correction Encoder and Decoder Using the Lee Metric and Adapted to Work on Multi-Level Physical Media”, U.S. Provisional Application No. 61/064,995, filed Apr. 8, 2008 and entitled “Systems and Methods for Error Correction and Decoding on Multi-Level Physical Media”, U.S. Provisional Application No. 60/996,948, filed Dec. 12, 2007 and entitled “Low Power BCH/RS Decoding: a Low Power Chien-Search Implementation”, U.S. Provisional Application No. 61/071,487, filed May 1, 2008 and entitled “Chien-Search System Employing a Clock-Gating Scheme to Save Power for Error Correction Decoder and other Applications” and U.S. Provisional Application No. 61/071,468, filed Apr. 30, 2008 and entitled “A Low Power Chien-Search Based BCH/RS Recoding System for Flash Memory, Mobile Communications Devices and Other Applications”.

Other co-pending applications include: U.S. Provisional Application No. 60/960,207, filed Sep. 20, 2007 and entitled “Systems and Methods for Coupling Detection in Flash Memory”, U.S. Provisional Application No. 61/071,467, filed Apr. 30, 2008 and entitled “Improved Systems and Methods for Determining Logical Values of Coupled Flash Memory Cells”, U.S. Provisional Application No. 60/960,943, filed Oct. 22, 2007 and entitled “Systems and methods to reduce errors in Solid State Disks and Large Flash Devices” and U.S. Provisional Application No. 61/071,469, filed Apr. 30, 2008 and entitled “Systems and Methods for Averaging Error Rates in Non-Volatile Devices and Storage Systems”, U.S. Provisional Application No. 60/996,027, filed Oct. 25, 2007 and entitled “Systems and Methods for Coping with Variable Bit Error Rates in Flash Devices”, U.S. Provisional Application No. 61/071,466, filed Apr. 30, 2008 and entitled “Systems and Methods for Multiple Coding Rates in Flash Devices”, U.S. Provisional Application No. 61/006,120, filed Dec. 19, 2007 and entitled “Systems and Methods for Coping with Multi Stage Decoding in Flash Devices”, U.S. Provisional Application No. 61/071,464, filed Apr. 30, 2008 and entitled “A Decoder Operative to Effect A Plurality of Decoding Stages Upon Flash Memory Data and Methods Useful in Conjunction Therewith”, U.S. Provisional Application No. 60/996,782, filed Dec. 5, 2007 and entitled “Systems and Methods for Using a Training Sequence in Flash Memory”, U.S. Provisional Application No. 61/064,853, filed Mar. 31, 2008 and entitled “Flash Memory Device with Physical Cell Value Deterioration Accommodation and Methods Useful in Conjunction Therewith”, U.S. Provisional Application No. 61/129,608, filed Jul. 8, 2008 and entitled “A Method for Acquiring and Tracking Detection Thresholds in Flash Devices”, U.S. Provisional Application No. 61/006,806, filed Jan. 31, 2008 and entitled “Systems and Methods for using a Erasure Coding in Flash memory”, U.S. Provisional Application No. 61/071,486, filed May 1, 2008 and entitled “Systems and Methods for Handling Immediate Data Errors in Flash Memory”, U.S. Provisional Application No. 61/006,078, filed Dec. 18, 2007 and entitled “Systems and Methods for Multi Rate Coding in Multi Level Flash Devices”, U.S. Provisional Application No. 61/064,923, filed Apr. 30, 2008 and entitled “Apparatus For Coding At A Plurality Of Rates In Multi-Level Flash Memory Systems, And Methods Useful In Conjunction Therewith”, U.S. Provisional Application No. 61/006,805, filed Jan. 31, 2008 and entitled “A Method for Extending the Life of Flash Devices”, U.S. Provisional Application No. 61/071,465, filed Apr. 30, 2008 and entitled “Systems and Methods for Temporarily Retiring Memory Portions”, U.S. Provisional Application No. 61/064,760, filed Mar. 25, 2008 and entitled “Hardware efficient implementation of rounding in fixed-point arithmetic”, U.S. Provisional Application No. 61/071,404, filed Apr. 28, 2008 and entitled “Apparatus and Methods for Hardware-Efficient Unbiased Rounding”, U.S. Provisional Application No. 61/136,234, filed Aug. 20, 2008 and entitled “A Method Of Reprogramming A Non-Volatile Memory Device Without Performing An Erase Operation”, U.S. Provisional Application No. 61/129,414, filed Jun. 25, 2008 and entitled “Improved Programming Speed in Flash Devices Using Adaptive Programming”, and several other co-pending patent applications being filed concurrently (same day).

FIELD OF THE INVENTION

The present invention relates generally to error correction encoding and decoding and more particularly to encoding and decoding in flash memory systems.

BACKGROUND OF THE INVENTION

Many types of flash memory are known. Conventional flash memory technology is described in the following publications inter alia:

-   Paulo Cappelletti, Clara Golla, Piero Olivo, Enrico Zanoni, “Flash     Memories”, Kluwer Academic Publishers, 1999 -   G. Campardo, R. Micheloni, D. Novosel, “CLSI-Design of Non-Volatile     Memories”, Springer Berlin Heidelberg New York, 2005

The Lee metric is a known metric-based error correction encoder/decoder functionality.

Prior art technologies related to the present invention include:

-   [1] “Error Correction Coding Mathematical Methods and Algorithms”,     Todd K. Moon, A JOHN WILEY & SONS, INC., 2005. -   [2] “Introduction to Coding Theory”, Ron M. Roth, Cambridge     University Press, 2006. -   [3] “Algebraic Codes for Data Transmission”, Richard E. Blahut,     Cambridge University Press, 2003.

References to square-bracketed numbers in the specification refer to the above documents.

The disclosures of all publications and patent documents mentioned in the specification, and of the publications and patent documents cited therein directly or indirectly, are hereby incorporated by reference.

SUMMARY OF THE INVENTION

The following terms may be construed either in accordance with any definition thereof appearing in the prior art literature or in accordance with the specification, or as follows:

Bit error rate (BER): a parameter that a flash memory device manufacturer commits to vis a vis its customers, expressing the maximum proportion of wrongly read bits (wrongly read bits/total number of bits) that users of the flash memory device need to expect at any time during the stipulated lifetime of the flash memory device e.g. 10 years. Block: a set of flash memory device cells which must, due to physical limitations of the flash memory device, be erased together. Also termed erase sector, erase block. Cell: A component of flash memory that stores one bit of information (in single-level cell devices) or n bits of information (in a multi-level device having 2 exp n levels). Typically, each cell comprises a floating-gate transistor. n may or may not be an integer. “Multi-level” means that the physical levels in the cell are, to an acceptable level of certainty, statistically partionable into multiple distinguishable regions, plus a region corresponding to zero, such that digital values each comprising multiple bits can be represented by the cell. In contrast, in single-level cells, the physical levels in the cell are assumed to be statistically partitionable into only two regions, one corresponding to zero and one other, non-zero region, such that only one bit can be represented by a single-level cell. Charge level: the measured voltage of a cell which reflects its electric charge. Cycling: Repeatedly writing new data into flash memory cells and repeatedly erasing the cells between each two writing operations. Decision regions: Regions extending between adjacent decision levels, e.g. if decision levels are 0, 2 and 4 volts respectively, the decision regions are under 0 V, 0 V-2 V, 2V-4 V, and over 4 V. Demapping: basic cell-level reading function in which a digital n-tuple originally received from an outside application is derived from a physical value representing a physical state in the cell having a predetermined correspondence to the digital n-tuple. Digital value or “logical value”: n-tuple of bits represented by a cell in flash memory capable of generating 2 exp n distinguishable levels of a typically continuous physical value such as charge, where n may or may not be an integer. Erase cycle: The relatively slow process of erasing a block of cells (erase sector), each block typically comprising more than one page, or, in certain non-flash memory devices, of erasing a single cell or the duration of so doing. An advantage of erasing cells collectively in blocks as in flash memory, rather than individually, is enhanced programming speed: Many cells and typically even many pages of cells are erased in a single erase cycle. Erase-write cycle: The process of erasing a block of cells (erase sector), each block typically comprising a plurality of pages, and subsequently writing new data into at least some of them. The terms “program” and “write” are used herein generally interchangeably. Flash memory: Non-volatile computer memory including cells that are erased block by block, each block typically comprising more than one page, but are written into and read from, page by page. Includes NOR-type flash memory, NAND-type flash memory, and PRAM, e.g. Samsung PRAM, inter glia, and flash memory devices with any suitable number of levels per cell, such as but not limited to 2, 4, or 8. Mapping: basic cell-level writing function in which incoming digital n-tuple is mapped to a program level by inducing a program level in the cell, having a predetermined correspondence to the incoming logical value. Page: A portion, typically 512 or 2048 or 4096 bytes in size, of a flash memory e.g. a NAND or NOR flash memory device. Writing can be performed page by page, as opposed to erasing which can be performed only erase sector by erase sector. A few bytes, typically 16-32 for every 512 data bytes are associated with each page (typically 16, 64 or 128 per page), for storage of error correction information. A typical block may include 32 512-byte pages or 64 2048-byte pages. Precise read, soft read: Cell threshold voltages are read at a precision (number of bits) greater than the number of Mapping levels (2̂n). The terms precise read or soft read are interchangeable. In contrast, in “hard read”, cell threshold voltages are read at a precision (number of bits) smaller than the number of Mapping levels (2̂ where n=number of bits per cell). Present level, Charge level: The amount of charge in the cell. The Amount of charge currently existing in a cell, at the present time, as opposed to “program level”, the amount of charge originally induced in the cell (i.e. at the end of programming) Program: same as “write”. Program level (programmed level, programming level): amount of charge originally induced in a cell to represent a given logical value, as opposed to “present level”. Reprogrammability (Np): An aspect of flash memory quality. This is typically operationalized by a reprogrammability parameter, also termed herein “Np”, denoting the number of times that a flash memory can be re-programmed (number of erase-write cycles that the device can withstand) before the level of errors is so high as to make an unacceptably high proportion of those errors irrecoverable given a predetermined amount of memory devoted to redundancy. Typically recoverability is investigated following a conventional aging simulation process which simulates or approximates the data degradation effect that a predetermined time period e.g. a 10 year period has on the flash memory device, in an attempt to accommodate for a period of up to 10 years between writing of data in flash memory and reading of the data therefrom. Resolution: Number of levels in each cell, which in turn determines the number of bits the cell can store; typically a cell with 2̂n levels stores n bits. Low resolution (partitioning the window, W, of physical values a cell can assume into a small rather than large number of levels per cell) provides high reliability. Retention: of original physical levels induced in the cells; retention is typically below 100% resulting in deterioration of original physical levels into present levels. Retention time: The amount of time that data has been stored in a flash device, typically without, or substantially without, voltage having been supplied to the flash device i.e. the time which elapses between programming of a page and reading of the same page. Symbol: Logical value

Threshold level: the voltage (e.g.) against which the charge level of a cell is measured. For example, a cell may be said to store a particular digital n-tuple D if the charge level or other physical level of the cell falls between two threshold values T.

Certain embodiments of the present invention seek to provide improved methods for error correction encoding and decoding, for flash memory and other applications.

Reed Solomon (RS) codes are common error correction codes (ECC) used in various applications such as storage and probably among the most prevalent codes today. These codes are particularly common when the output from the physical media is binary and there is no additional information regarding the reliability of the bits. In some cases these codes are also used to handle the case of erasures—i.e. bits whose value is unknown.

Many of these codes are systematic. That is, the code may be divided into two sections, the first containing the original data and the second containing spare bits, containing redundant information which allows a decoder to reconstruct the original data if errors have occurred in the first and/or second sections. The number of errors that can be corrected is a function of the code length and of the length of the redundancy within the code.

In RS codes, the data sequence is a bit sequence which is divided into subsets called symbols. The code itself is a sequence of symbols and only symbols are corrected. It is irrelevant which bit or if several bits (say f, the number of bits in a symbol) were in error in a symbol; the symbol is corrected as a unit. The code t has a limit on the number of symbols that can be corrected regardless of how many bits were corrected. That is, an RS code can correct all received sequences as long as their Hamming distance from the original codeword is not larger than a certain value given by D/2, where “Hamming distance” between two sequences of symbols is the count of a number of different symbols between the sequences. D is also equal to the number of symbols in the redundancy section of the code; therefore, the redundancy would have D*f bits. A special case of RS codes are binary BCH codes, also known as alternant codes. These codes may be viewed as a subset of RS codes where only those code-words whose symbols are only 0 and 1 are used. With these codes it is possible to correct up to D errors with a redundancy of D*f bits. f is now chosen such that the overall length of the code (n) is smaller than n<2f. The code corrects sequences as long as their Hamming distance is less than or equal to D, where the Hamming distance is taken over bits.

Certain embodiments of the present invention seek to provide a code which outperforms the binary BCH code for certain applications e.g. those in which short bit sequences are mapped to different levels—such as, for example, in multi-level Flash memory devices where every 2-4 bits are mapped to 4-16 levels.

Prior art FIG. 1 illustrates the distribution of the charge level in a 2 bit/cell Flash device. Every 2 bits are mapped into one of the 4 levels in each cell. Errors may occur if one charge level is read as another. Almost all errors occur when one level is mistaken for an adjacent level. Only rarely do errors occur between non-adjacent levels.

If a binary BCH code is used, gray mapping of the levels into bits assists in reducing the number of bit error per programmed cell. However, the binary BCH code does not take into account the fact that more than one bit error per cell occurs only very rarely indeed.

There is thus provided, in accordance with at least one embodiment of the present invention, a method for error correction encoding of L level application data residing in a memory comprising L level Multi-level cells (MLCs) including at least some Multi-level cells (MLCs) in which the application data is residing and at least some Multi-level cells (MLCs) which are at least partly available to accept data other than the application data, the method comprising encoding the L level application data over a prime field thereby to generate non-binary redundancy data, binarizing at least some of the non-binary redundancy data thereby to generate binarized redundancy data, effecting binary error-correction encoding of the binarized redundancy data, thereby to generate binary redundancy data, combining the binarized redundancy data and the binary redundancy data thereby to generate combined binarized/binary redundancy data; and restoring the combined binarized/binary redundancy data to L level form, thereby to generate restored L level redundancy data, and storing the restored L level redundancy data in at least some of the at least partly available L level Multi-level cells (MLCs).

Further in accordance with at least one embodiment of the present invention, the method also comprises, for at least one L level MLC, utilizing less than L levels for storing at least a portion of the L level application data and utilizing remaining ones of the L levels for storing at least a portion of the combined binarized/binary redundancy data.

Still further in accordance with at least one embodiment of the present invention, binarizing comprises binarizing all of the non-binary redundancy data.

Additionally in accordance with at least one embodiment of the present invention, binarizing comprises binarizing only some of the non-binary redundancy data thereby to define a portion of the non-binary redundancy data which is un-binarized, and wherein the method also comprises L-level transforming the un-binarized non-binary redundancy data to L-level un-binarized non-binary redundancy data.

Still further in accordance with at least one embodiment of the present invention, binarizing and L-level transforming are effected by a single transform function.

Further in accordance with at least one embodiment of the present invention, the method also comprises storing the L-level un-binarized non-binary redundancy data in the L level Multi-level cells (MLCs).

Still further in accordance with at least one embodiment of the present invention, the encoding over a prime field comprises Reed-Solomon encoding over a prime field.

Still further in accordance with at least one embodiment of the present invention, the combining comprises concatenating the binarized redundancy data and the binary redundancy data thereby to generate concatenated binarized/binary redundancy data.

Additionally in accordance with at least one embodiment of the present invention, the binary error-correction encoding comprises BCH encoding of the binarized redundancy data, thereby to generate BCH-encoded redundancy data.

Further in accordance with at least one embodiment of the present invention, the at least some Multi-level cells (MLCs) which are at least partly available to accept data other than the application data comprise entirely available Multi-level cells (MLCs) in which no L level application data is residing, and wherein the storing comprises storing the restored L level redundancy data in at least some of the entirely available L level Multi-level cells (MLCs).

Also provided, in accordance with at least one embodiment of the present invention, is a method for error correction decoding of at least restored L level redundancy data residing in a memory comprising L level Multi-level cells (MLCs) including at least some Multi-level cells (MLCs) in which possibly erroneous L-level application data resides and at least some Multi-level cells (MLCs) which store at least the restored L level redundancy data, the method comprising binarizing the at least restored L level redundancy data, thereby to generate binarized restored L level redundancy data, deriving binary redundancy data from the binarized restored L level redundancy data, effecting binary error-correction decoding of the binary redundancy data, thereby to generate binarized redundancy data, transforming the binarized redundancy data to generate non-binary redundancy data, and decoding the non-binary redundancy data and the possibly erroneous L-level application data over a prime field, thereby to generate decoded L level application data.

Further in accordance with at least one embodiment of the present invention, binarizing comprises binarizing only some of the non-binary redundancy data thereby to define a portion of the non-binary redundancy data which is un-binarized, and wherein the method also comprises L-level transforming the un-binarized non-binary redundancy data to L-level un-binarized non-binary redundancy data.

Also provided, in accordance with at least one embodiment of the present invention, is an apparatus for error correction encoding of L level application data residing in a memory comprising L level Multi-level cells (MLCs) including at least some Multi-level cells (MLCs) in which the application data is residing and at least some Multi-level cells (MLCs) which are at least partly available to accept data other than the application data, the apparatus comprising prime-field encoding apparatus operative to encode the L level application data over a prime field thereby to generate non-binary redundancy data, binarization apparatus operative to binarize at least some of the non-binary redundancy data thereby to generate binarized redundancy data, binary ECC apparatus operative to effect binary error-correction encoding of the binarized redundancy data, thereby to generate binary redundancy data; and data combination apparatus operative to combine the binarized redundancy data and the binary redundancy data thereby to generate combined binarized/binary redundancy data, and L-level restoration apparatus operative to restore the combined binarized/binary redundancy data to L level form, thereby to generate restored L level redundancy data, and storing the restored L level redundancy data in at least some of the at least partly available L level Multi-level cells (MLCs).

Additionally provided, in accordance with at least one embodiment of the present invention, is a method for operating a flash device, the method comprising using Lee distance based codes in the flash device, thereby increasing the number of errors that can be corrected for a given number of redundancy cells compared with Hamming distance based codes.

Also provided, in accordance with at least one embodiment of the present invention, is a method for operating a flash device, the method comprising providing a Lee code associated with a first group of symbols; and coding data in the flash device using a second group of symbols, the second group being a sub group of the first group, so as to allow extending the number of errors that can be corrected for a given number of redundancy cells compared with Hamming distance based codes.

Further provided, in accordance with yet another embodiment of the present invention, is a method for operating a flash device, the method comprising providing a Lee code associated with a first group of symbols, coding data in the flash device using a second group of symbols, the second group being a sub group of the first group, giving rise to a first data stream, producing a redundancy data stream from the first data stream using a redundancy code, thereby increasing the number of errors that can be corrected for a given number of redundancy cells compared with Hamming distance based codes. Further in accordance with at least one embodiment of the present invention, the first data stream is associated with a first group of symbols and the redundancy data stream is associated with a second group of symbols, the second group being a sub group of the first group.

Further provided, in accordance with at least one embodiment of the present invention, is a decoding system comprising a Lee metric-based decoder operative to decode multi-level physical media.

Also provided, in accordance with at least one embodiment of the present invention, is a method for error correction comprising encoding and decoding, thereby to effect error correction and using a separate encoder to store a Syndrome computation to be used during the decoding.

Yet further provided, in accordance with at least one embodiment of the present invention, is a method for error correction comprising encoding and decoding, thereby to effect error correction, including encoding a syndrome; and encapsulating and mapping the encoded syndrome into designated media cells.

Also provided, in accordance with at least one embodiment of the present invention, is a method for error correction comprising encoding and decoding, thereby to effect error correction, including encoding a syndrome, and reducing error probability in the encoded Syndrome by encapsulating and mapping the encoded Syndrome mixed with data bits into designated media cells.

Also provided, in accordance with at least one embodiment of the present invention, is a method for error correction comprising encoding and decoding, thereby to effect error correction, including multiplying by an inverse matrix to achieve a reduced number of bits sufficient to encode the syndrome and encoding the syndrome using only the reduced number of bits.

Further in accordance with at least one embodiment of the present invention, the multi-level physical media includes media having less levels than symbol values.

Any suitable processor, display and input means may be used to process, display, store and accept information, including computer programs, in accordance with some or all of the teachings of the present invention, such as but not limited to a conventional personal computer processor, workstation or other programmable device or computer or electronic computing device, either general-purpose or specifically constructed, for processing; a display screen and/or printer and/or speaker for displaying; machine-readable memory such as optical disks, CDROMs, magnetic-optical discs or other discs; RAMs, ROMs, EPROMs, EEPROMs, magnetic or optical or other cards, for storing, and keyboard or mouse for accepting. The term “process” as used above is intended to include any type of computation or manipulation or transformation of data represented as physical, e.g. electronic, phenomena which may occur or reside e.g. within registers and/or memories of a computer.

The above devices may communicate via any conventional wired or wireless digital communication means, e.g. via a wired or cellular telephone network or a computer network such as the Internet.

The apparatus of the present invention may include, according to certain embodiments of the invention, machine readable memory containing or otherwise storing a program of instructions which, when executed by the machine, implements some or all of the apparatus, methods, features and functionalities of the invention shown and described herein. Alternatively or in addition, the apparatus of the present invention may include, according to certain embodiments of the invention, a program as above which may be written in any conventional programming language, and optionally a machine for executing the program such as but not limited to a general purpose computer which may optionally be configured or activated in accordance with the teachings of the present invention.

Any trademark occurring in the text or drawings is the property of its owner and occurs herein merely to explain or illustrate one example of how an embodiment of the invention may be implemented.

Unless specifically stated otherwise, as apparent from the following discussions, it is appreciated that throughout the specification discussions, utilizing terms such as, “processing”, “computing”, “estimating”, “selecting”, “ranking”, “grading”, “calculating”, “determining”, “generating”, “reassessing”, “classifying”, “generating”, “producing”, “stereo-matching”, “registering”, “detecting”, “associating”, “superimposing”, “obtaining” or the like, refer to the action and/or processes of a computer or computing system, or processor or similar electronic computing device, that manipulate and/or transform data represented as physical, such as electronic, quantities within the computing system's registers and/or memories, into other data similarly represented as physical quantities within the computing system's memories, registers or other such information storage, transmission or display devices.

BRIEF DESCRIPTION OF THE DRAWINGS

Certain embodiments of the present invention are illustrated in the following drawings:

FIG. 1 is a prior art graph of physical level distributions in a two-bit per cell flash memory device;

FIG. 2 is a simplified functional block diagram of a “syndrome separate” encoder constructed and operative in accordance with certain embodiments of the present invention;

FIG. 3 is a simplified functional block diagram of a “syndrome separate” decoder constructed and operative in accordance with certain embodiments of the present invention;

FIG. 4 is a simplified functional block diagram of a “syndrome separate, redundancy & data mixed” encoder constructed and operative in accordance with certain embodiments of the present invention;

FIG. 5 is a simplified functional block diagram of a “syndrome separate, redundancy & data mixed” decoder constructed and operative in accordance with certain embodiments of the present invention;

FIG. 6 is a simplified functional block diagram of a “syndrome separate & shortened” encoder constructed and operative in accordance with certain embodiments of the present invention;

FIG. 7 is a simplified functional block diagram of a “syndrome separate & shortened” decoder constructed and operative in accordance with certain embodiments of the present invention;

FIG. 8 is a simplified functional block diagram of a “syndrome separate & shortened, redundancy & data mixed” encoder constructed and operative in accordance with certain embodiments of the present invention;

FIG. 9 is a simplified functional block diagram of a “syndrome separate & shortened, redundancy & data mixed” decoder constructed and operative in accordance with certain embodiments of the present invention;

FIG. 10A is a table representing a first mapping scheme in which each subsequence is mapped into a number represented by the binary representation of that sequence;

FIG. 10B is a table representing a second mapping scheme in which each subsequence is mapped into a symbol using “Gray coding”;

FIG. 11 is a simplified flowchart illustration of a method for encapsulating input data bits, in accordance with certain embodiments of the present invention;

FIG. 12 is a simplified flowchart illustration of a method for de-encapsulation which may be performed by Demapper B in the decoder of FIG. 3, in accordance with certain embodiments of the present invention;

FIG. 13 is a simplified flowchart illustration of a method for de-encapsulation which may be performed by the mapper in the decoder of FIG. 3, in accordance with certain embodiments of the present invention;

FIG. 14 is a diagram of a codeword generated by the encoder of FIG. 8, in accordance with certain embodiments of the present invention;

FIG. 15 is a diagram of a codeword generated by the encoder of FIG. 2, in accordance with certain embodiments of the present invention;

FIG. 16 is a diagram of a codeword generated by the encoder of FIG. 4, in accordance with certain embodiments of the present invention;

FIG. 17 is a diagram of a codeword generated by the encoder of FIG. 6, in accordance with certain embodiments of the present invention;

FIG. 18A is a simplified functional block diagram illustration of a NAND Flash device interacting with an external controller with Lee-metric based error correction encoding & decoding functionality in accordance with certain embodiments of the present invention;

FIG. 18B is a simplified functional block diagram illustration of a flash memory system including an on-board microcontroller, with Lee-metric based error correction encoding & decoding functionality in accordance with certain embodiments of the present invention, wherein the encoding functionality may comprise any of the encoders of FIGS. 2, 4, 6 and 8 and the decoding functionality may comprise any of the decoders of FIGS. 3, 5, 7 and 9 respectively;

FIG. 19 is a simplified flowchart illustration of a method for effecting a NAND flash program command issued by the controller of FIG. 18A, in accordance with certain embodiments of the present invention; and

FIG. 20 is a simplified flowchart illustration of a method for effecting a NAND flash read command issued by the controller of FIG. 18A, in accordance with certain embodiments of the present invention.

DETAILED DESCRIPTION OF CERTAIN EMBODIMENTS

Apparatus and methods for operating a flash device are now described, which are characterized by use of Lee distance based codes in the flash device so as to increase the number of errors that can be corrected for a given number of redundancy cells, compared with Hamming distance based codes.

The Lee distance between two sequences of symbols is the absolute sum of differences. If there are two symbols, S1 and S2, which take values between 0 and p−1 where p is a prime number, then the Lee distance between these two symbols is then given by

${D\left( {S_{1},S_{2}} \right)} = \left\{ {\begin{matrix} {{S_{1} - S_{2}}} & {{{S_{1} - S_{2}}} < {\left( {p - 1} \right)/2}} \\ {p - {{S_{1} - S_{2}}}} & {{{S_{1} - S_{2}}} \geq {\left( {p - 1} \right)/2}} \end{matrix}.} \right.$

The distance between two sequences Si and Ri is then given by

$\sum\limits_{i = 0}^{n - 1}{D\left( {S_{i},R_{i}} \right)}$

where n is the number of symbols in each of the two sequences.

Thus, using the above distance, the measure between two sequences is the number of level shifts assuming that per symbol there is a maximum of one error, i.e. either a single positive shift or a single negative shift; the Lee distance measure is suitable since the fact that multiple shifts per symbol are rare is now taken into account. Generally speaking, gain, compared with binary BCH, results from the fact that less bits are now used to store a full symbol.

In the described embodiments of the present invention, the use of the terms flash memory, flash memory device, flash memory apparatus, solid state disk, memory device and similar is non-limiting and interchangeable (also referred to in general as “storage apparatus”). In certain embodiments of the present invention, the elements associated with the storage apparatus as well as the sequence of operations carried out, are integral to the storage apparatus. In certain other embodiments of the present invention, at least some of the elements associated with the storage apparatus and at least some of the related operations are external to the flash, the solid state disk etc. For example, some of the operations performed by microcontroller 110 of FIG. 18A may be carried out by the central processing unit of the host 100, without limiting the scope of the present invention. For convenience only, the following description of certain embodiments of the present invention refers mainly to the term flash memory or solid state disk, however those versed in the art will readily appreciate that the embodiments that are described with reference to flash memory or solid state disk are likewise applicable mutatis mutandis to other storage apparatuses.

Although the applicability of the current invention is not limited to Flash memory devices, these are considered throughout for the sake of brevity.

One application of this invention, as shown in FIG. 18A, is in NAND Flash applications such as SD cards and USB drives. In these applications, the system comprises a controller 2400 and at least one NAND flash 2405 and perhaps many such as shown. The controller 2400 interfaces to a host through a specified protocol. For example, in the case of a USB drive the protocol is that defined by universal serial bus protocol. The controller 2400 then translates commands from the host. For example, read/write commands are translated into page read, page program and block erase commands on the Flash device 2405 through the NAND interface protocol. In order to combat errors which may occur in the multi-level NAND flash devices, code operative in accordance with certain embodiments of this invention may be employed, e.g. by adding an encoding operation to each program command and adding a decoding operation to each read command. The encoding/decoding operations shown and described herein may replace existing encode/decode operations using less efficient codes.

The NAND devices 2405 are programmed page by page where each page may contain cells that store data and cells that store redundancy. Both sets of cells are used, such that the data and redundancy are spread over both. In the course of a NAND Flash interface program and read commands the page data is transferred as a sequence of bits and the bits are then mapped into cells. During a program or read command issued by the controller 2400, the output of encoder 2320 is mapped into bits such that when stored in the Flash device, the bits are mapped back into symbols in Flash cells as defined by the encoders' output. This process is shown in FIG. 19, for a programming procedure, and in FIG. 20, for a read command.

Taking a 4-level multi-level cell (MLC) device as an example, it is common to match each physical page (i.e. page in the Flash array 2420) into two logical pages such that each cell contains a bit from each of the logical pages, mapped using Gray coding. Here, the basic unit is two logical pages and each NAND flash read/program command is a sequence of two read/program commands of a logical page.

Alternatively, as shown in FIG. 18B, a flash memory device may be provided whose internal or on-board microcontroller has Lee metric-based error correction encoder/decoder functionality capable of effectively correcting more errors than a binary BCH code for a given length of redundancy. Four examples of encoding and decoding schemes in accordance with certain embodiments of the present invention, are now described, which employ four example codes respectively, termed the “syndrome separate” code, “syndrome separate, redundancy & data mixed” code, the “syndrome separate & shortened” code and the “syndrome separate & shortened, redundancy & data mixed” code respectively. Encoders and decoders employing these codes respectively, each constructed and operative in accordance with certain embodiments of the present invention are presented in FIGS. 2 and 3; 4 and 5; 6 and 7; 8 and 9 respectively.

The codes are used to encode information over a multi-level physical medium such as a Flash memory. Thus, the inputs and outputs of the Flash device are symbols containing L levels denoted by “0”, “1”, “2”, through “L−1”. The inputs to the encoder are always assumed to be a sequence of bits while the inputs to the decoder are assumed to be a sequence of Flash symbols. The flash symbols could be represented as a subset of a finite field. More precisely, these symbols may be viewed as a subset of a finite-filed GF(p) where p is a prime number.

The encoders receive k bits, where k is a predetermined constant, and produce n symbols, where n is a predetermined constant. n is such that n*log₂ L>k where n*log₂ L−k is, generally speaking, the number of spare bits allocated for the code for error correction purposes.

The “syndrome separate” code is characterized by a separately encoded syndrome. The “syndrome separate” code is now described with reference to FIGS. 2 and 3, and using the following symbols:

k—number of data bits to be encoded

n—number of symbols in encoded word

L—number of levels

r—number of bits to be encapsulated by Mapper A (100 in FIG. 2)

t—number of symbols produced by Mapper A (100)

p—the smallest prime larger than t

D_(i) (i=0 . . . t−1)—output symbols of Mapper A (100) comprising numbers in GF(p) with values between 0 and L−1.

w—number of symbols produced by the Syndrome Computation block (110) of FIG. 2.

S_(j) (j=0 . . . w−1)—output symbols of the Syndrome computation block (110) comprising numbers in GF(p).

α—a non-zero element of GF(p) which is also a primitive element in GF(p).

k′—the number of bits mapped by the Demapper unit (120) following the mapping of the w symbols outputted by the Syndrome Computation block (110).

n′—number of bits at the output of the BCH encoder unit (130).

r′—number of symbols encapsulated at once by the Demapper unit (120).

FIG. 2 represents the “syndrome separate” encoder. The input to the encoder, a sequence of k bits, is mapped into t symbols by Mapper A (100). p is the smallest prime larger than or equal to t. If L is a power of 2, the data is divided into subsequences of log₂ L bits, each subsequence being mapped into a symbol between 0 to L−1, these symbols being numbers in the prime field GF(p). Mapping may be effected e.g. by mapping each subsequence into a number represented by the binary representation of that sequence as shown in the table of FIG. 10A. Another possibility is to use Gray coding as shown in the table of FIG. 10B. Gray coding is not crucial for Mapper A because the performance of the code is not degraded if a different mapping is used, due to the fact that the encoding scheme shown and described herein works on entire symbols and not on individual bits.

If L is not a power of 2 encapsulation may be used, typically dividing the input sequence into subsequences of r bits which are then translated into a sequence of

$\left\lceil \frac{r}{\log_{2}L} \right\rceil$

symbols over GF(p) where each symbol is one of 0, 1, . . . , L−1. This may be done by representing the r bits as a number (in the standard number field) and following the procedure described in FIG. 11 to recover the symbols. In the method of FIG. 11, Z is, initially, the number represented by the r bits, and the following computations are repeated

$\left\lceil \frac{r}{\log_{2}L} \right\rceil$

times: Symbol_(Counter)=remainder of the division of Z by L; and computation of Z as the quotient of the division of the previous Z by L. r is a predefined constant chosen to maximize the efficiency of encapsulation but yet sufficiently small to allow adequate implementation of the method in FIG. 11 either in hardware or software.

The output of Mapper A (100) then goes to a delay line block (150) and to a Syndrome computation block (110). The purpose of the delay line (150) is to delay the sequence of the t symbols produced by the Mapper A block (100) such that the first symbols produced by (140) follow immediately after the last symbol was outputted from delay line (150).

The Syndrome computation block (110) produces w elements in GF(p). As described above, the t symbols outputted from Mapper A block (100) are treated like numbers in the field GF(p). The Syndrome computation block (110) then performs the following computation:

$S_{j} = {\sum\limits_{i = 0}^{t - 1}{D_{i}\alpha^{ji}}}$

where D_(i) (i=0 . . . t−1) are the output symbols of Mapper A (100), S_(j) (j=0 . . . w−1) are the output symbols of the Syndrome computation block (110) and α is a number between 1 and p−1 which is also a primitive element in GF(p). All multiplications and additions are carried out in the GF(p) field (i.e. modulo p). Finite fields, primitive elements, and other related aspects of the above computations are described in documents [2] and [3].

The output of the Syndrome computation unit (110) then flows to the Demapper unit (120). The Demapper maps the w GF(p) symbols into k′ bits, again, typically by using encapsulation. That is, the w symbols are divided into subsets each including r′ symbols, other than, possibly, one subset which has less than r′ symbols. Each subset is then mapped into bits using the binary representation of the number (now in the standard field):

$\sum\limits_{i = 0}^{r^{\prime} - 1}{S_{i}{p^{i} \cdot}}$

This number is mapped into a sequence of ┌r′·log₂ p┐ bits.

The output of the Demapper (120) flows into a binary BCH encoder (130) which receives k′ bits and produces n′ bits which include, on top of the original k′ bits, additional n′−k′ redundancy bits which are used for error correction in the decoding process. The binary BCH encoder is a standard encoder as is known in the art such as any of these described in references [1], [2] and [3] and designed to function over GF(2^(┌log) ² ^(n′┐)).

The output of the binary BCH encoder (130) is then mapped into symbol Mapper B (140) which receives n′ bits and maps them into n−t symbols. The mapping is performed similarly to that performed by Mapper A, typically using Gray coding. Again, if the number of levels is not a power of 2, encapsulation is effected as for Mapper A. If L is a power of 2 then the sequence of n′ bits is simply divided into subsets of log₂ L bits. If the sequence does not exactly divide, the sequence is zero padded until it is divided by log₂ L without a quotient. The subsets of log₂ L bits are then mapped using Gray coding as shown e.g. in the table of FIG. 10B.

A Selector (160) enables the flow of either the mapped original data from the delay line or the mapped redundancy data from Mapper B (140). At first, typically the selector enables the delay line to flow out; once this has occurred, the output of Mapper B (140) flows out. The delay line is designed to delay the output of Mapper A (100) such that the output of Mapper B is synchronized to the end of the output of the delay line. The end result is a codeword as shown in FIG. 15.

As shown, the codeword of FIG. 15 typically comprises a first portion (1500) which includes a mapping of the data sequence into L levels, and a second portion (1510) which is used as redundancy for the purpose of error correction of the information in the first portion 1500. Second portion 1510 is also mapped into L levels and also typically comprises two portions: a first portion (1520) including the mapping of the syndrome (computed from portion 1500) mapped into bits and then mapped to L levels; and a second portion (1530) including the mapping to L levels of the redundancy as computed by the BCH encoder of the portion (1520).

FIG. 3 shows a schematic view of the “syndrome separate” decoder. The “syndrome separate” decoder of FIG. 3 typically receives n symbols from the Flash device and produces k correct bits. The n received symbols belong to one of L levels and may contain errors causing the wrong level to be read. The first t symbols are associated with actual data whereas the last n−t symbols are associated with redundancy. The first t symbols and the last n−t symbols may be sent to the decoder of FIG. 3 simultaneously and analyzed simultaneously. If all n symbols are not sent simultaneously to the decoder, it is more efficient to send the last n−t symbols, which store the redundancy, first, followed by the first t symbols. The redundancy may then be decoded as the rest of the symbols are being sent to the decoder.

The first t symbols are sent to the Syndrome Computation unit which typically performs the same task as was performed by syndrome computation unit 110 in the “syndrome separate” encoder of FIG. 2. The last n−t symbols are sent to a Demapper B 200 which performs the converse of the operation performed by the Mapper B (140) in FIG. 2. The Demapper receives n−t symbols and produces n′ bits.

If the number of levels, L, is a power of 2, the Demapper 200 simply produces log₂ L bits for every symbol, the bits being produced by a process of Gray coding e.g. according to the table of FIG. 10B. If L is not a power of 2, de-encapsulation is performed to reverse the effect of encapsulation. That is, the n−t symbols are divided into sub-sequences of ┌r/log₂ L┐ symbols from which the Demapper B 200 produces r bits. FIG. 12 shows a procedure which may be employed to perform the De-encapsulation. In the method of FIG. 12, Symbol_(0 . . . ┌r/log) ₂ _(L┐) is a subsequence of symbols and Z is initially 0. Z=Z+Symbol_(Counter)*L^((Counter−1)) is repeated

$\left\lceil \frac{r}{\log_{2}L} \right\rceil$

times and the output is the binary representation of the final value of Z.

The binary output of the Demapper 200 is a sequence of n′ bits which are passed to the binary BCH decoder (210) which corrects any errors which might have occurred in the redundancy symbols. The BCH decoding may be effected as known in the art e.g. as described in references ([1], [2], [3]).

The BCH decoder (210) outputs k′ bits which were used to code the Syndrome during the encoding process performed by the encoder of FIG. 2. The k′ bits are passed to a mapper unit (220) which produces w symbols over GF(p). This time the symbols may assume values from 0 to p−1. The mapper unit (220) performs the converse of the operation performed by the Demapper unit (120) in the encoder of FIG. 2, e.g. by De-encapsulation. The k′ bits are divided into subsets of ┌r′·log₂ p┐. The symbols may be derived by representing the subset as a number (in the normal field) and performing the method in FIG. 13. In the method of FIG. 13, Z, initially, is the number represented by the ┌r′·log₂ p┐ bits and the following computations are repeated r′ times: Symbol_(Counter)=remainder of the division of Z by p; and new Z=the quotient of the division of the current value of Z, by p.

The output of Mapper (220) is the accurate Syndrome whereas the output of the Syndrome Computation unit (230) is the estimated syndrome according to the received symbols from the device. The difference between them is the syndrome only due to the error. Thus, the output of the subtract block (240) is the difference (symbol by symbol) of the two syndromes and is the syndrome of the errors that occurred in the first t symbols. Using the output of the subtraction unit 240, the eligible word which is closest (by the Lee metric) to the word actually received, is recovered by best eligible word recovery block 250. Any suitable conventional method can be used to effect the recovery, such as that described in steps 2-5 on page 311 Section 10.4 (“Decoding alternant codes in the Lee metric”), in reference [2]. Once the correct symbols have been recovered, Demapper A (260) maps the t symbols back into k bits. The Demapper A undoes the operation of Mapper A (100) in the “syndrome separate” encoder of FIG. 2, similarly to Demapper B. However, it is not necessary to use Gray mapping.

Parameter determination according to certain embodiments of the present invention is now described. The length of the input sequence (in bits) and the length of the code word (in symbols) are given by conventional design preferences that are typically unaffected by the teachings of the invention shown and described herein, so k and n are assumed to be known. Therefore, values for the constant p and the number of symbols that contain data t are also immediately available. The encapsulation parameters r and r′ are determined by hardware complexity restrictions; for example, r may not be limited to less than 128 bits. The remaining parameters may be determined by trading off the number of BCH redundancy bits n′−k′ and the number of Syndrome symbols w, it being appreciated that n′ bits may be stored in n−t symbols. The tradeoff is typically between the number of bits (n′−k′) allocated to correct the “accurate” Syndrome and the number of symbols (w) allocated to correct the data referred to above, as stored in the word referred to above.

P_(err) denotes the frame error rate and P_(cross) denotes the probability that an individual level is erroneously read as either the following or preceding level. The probability of error may be approximated by assuming that errors only occur between nearby levels.

A decoding error may occur if either one of the following events occurs:

-   -   1. An error occurs in the decoding of “accurate” Syndrome (210).         i.e., there were more than └(n′−k′)/┌log₂ n┐┘ errors in the         (n−t) symbols allocated to store the redundancy.     -   2. An error occurs in the decoding of the data symbols using the         Lee metric decoder (240). i.e., there were w or more errors in         the first t symbols.         -   The probability of any of these events may be bounded from             above by

$P_{err} \leq {{\sum\limits_{i = {{\lfloor{{({n^{\prime} - k^{\prime}})}/{\lceil{\log_{2}n^{\prime}}\rceil}}\rfloor} + 1}}^{n - t}{\frac{\left( {n - t} \right)!}{{i!}{\left( {n - t - i} \right)!}} \left( {\frac{{2L} - 2}{L}p_{cross}} \right)^{i}\left( {1 - {\frac{{2L} - 2}{L}P_{cross}}} \right)^{n - t - i}}} + {\sum\limits_{i = w}^{t}{\frac{t!}{{i!}{\left( {t - i} \right)!}} \left( {\frac{{2L} - 2}{L}p_{cross}} \right)^{i}\left( {1 - {\frac{{2L} - 2}{L}P_{cross}}} \right)^{t - i}}}}$

-   -   -   Thus, by enumerating over w, a value may be selected which             reduces the above probability, typically to a minimum.

In “syndrome separate, redundancy & data mixed” code the redundancy symbols are no longer separated from the data symbols but rather mixed with them. This is done in such a manner that the error probability in the redundancy information is decreased. The downside is that p (the prime used for the Lee-metric code) increases with respect to n, which may decrease the error correction capability of the Lee-metric decoder. The number of levels, L, is assumed above to be a power of 2. However, where L is not a power of 2, encapsulation may be used, as described generally above. The following symbols are used in the description of the “syndrome separate, redundancy & data mixed” code:

k—number of data bits to be encoded

n—number of symbols in encoded word

L—number of levels

t—number of symbols produced by Mapper A (300).

p—the smallest prime larger than n

D_(i) (i=0 . . . n−1)—Combined symbol output of Mapper A (300) and A′ (310) comprising numbers in GF(p) with values between 0 and L−1.

w—number of symbols produced by the Syndrome Computation block (340)

S_(j) (j=0 . . . w−1)—output symbols of the Syndrome computation block (340) comprising numbers in GF(p).

k′—the number of bits mapped by the Demapper unit (350) following the mapping of the w symbols outputted by the Syndrome Computation block (340).

n′—number of bits at the output of the BCH encoder unit (360).

b_(i)—bit i (=0 . . . n′−1) of the output sequence of the BCH encoder unit (360).

Y_(i)—the symbols (i=0 . . . n−1) at the output of the Mapper B (370) unit.

-   -   FIG. 4 shows a schematic view of an encoder for the “syndrome         separate, redundancy & data mixed” code. The input is a sequence         of bits (k bits) which flows into Mappers A (300) and A′ (310).         The first t·log₂ L bits are mapped by Mapper A into symbols over         GF(p) with values between 0 and L−1. Mapper divides the t·log₂ L         bits into subsequences of log₂ L which are mapped into symbols         using any type of mapping (for example the mappings in the         tables in FIG. 10). It is appreciated that the choice of the         mapping does not affect the performance of the code. The last         k−t·log₂ L bits of the input sequence are mapped by Mapper A′         into symbols over GF(p) with values between 0 and L/2−1. This is         done by dividing the remaining bits into subsequences of log₂         L−1 bits and mapping the subsequences into symbols according to         any mapping scheme.     -   The Selector (320) simply adjust the flow of the symbols such         that the symbols generated by Mapper A′ (310) follow the last         symbols generated by Mapper A (300). Overall, there are n         symbols (i.e. n=t+┌k−t·log₂ L)/(log₂ L−1)┐.         The symbols flow into the syndrome computation unit (340) which         performs the same task as performed by the syndrome computation         unit (110) in the “syndrome separate” encoder of FIG. 2. This         unit produces w symbols over GF(p) (this time, the symbols take         any value between 0 and p−1).

The w symbols then flow into the Demapper (350) which performs the same task as performed by the Demapper unit (120) in the “syndrome separate” encoder. The output of the Demapper (350) is k′ bits which flow into the binary BCH encoder (360) which produces n′ bits. Again, unit 360 is identical to unit 130 in the “syndrome separate” encoder of FIG. 2.

The output of the BCH encoder (360) then flows into Mapper B (370). The purpose of Mapper B is to combine the outputs of the Mapper A′ (310) with the output of the BCH encoder. More precisely, Mapper A′ (310) produces ┌(k−t·log₂ L)/(log₂ L−1┐ symbols with values between 0 and L/2−1┐. The BCH encoder (360) produces n′ bits. Typically, n′=┌(k−t·log₂ L)/(log₂ L−1)┐. That is, t=n−n′. The combined output is a symbol with values between 0 and L−1. This is done using the following formula:

Y _(i) =D _(i) +b _(i) ·L/2, i=n−n′ . . . n−1,

where Y_(i) are the symbols at the output of the Mapper B (370) unit, D_(i) are the symbols at the output of the Selector unit (320) and b_(i) are the bits (with values of 0 and 1) at the output of the BCH encoder (360).

The purpose of the Delay Line (330) is to delay the sequence of the symbols such that symbols i=n−n′ may enter Mapper B (370) when the output of the BCH encoder is ready. The selector unit 380 then outputs the first t symbols from the delay line and the rest of the n′=n−t symbols from Mapper B.

The end result of this process is a codeword structured as shown in FIG. 16 which comprises 2 portions. The first portion (2100) includes the mapping of t·log₂ L data bits into L-level symbols. The second portion (2110) includes both data and redundancy mapped into L-level symbols. This is done by letting the data determine the log₂ L−1 LSB bits of the index of the L-level symbol. The syndrome (after mapping it into bits) and the redundancy of the BCH codes determine the most significant bit of the index of the L-level symbol.

FIG. 5 gives a schematic view of a decoder for the “syndrome separate, redundancy & data mixed” code. The n symbols of the code flow simultaneously into Demapper A′ (400) and Demapper A (430). Demapper A (430) handles separately the first t symbols and the latter n′ symbols. The first t symbols are passed ‘as is’ to the Syndrome computation unit (440) while the latter n′ symbols are stripped from the Redundancy information produced by the BCH encoder (360) in the encoder. This is done as follows:

${\hat{F}}_{i} = \left\{ \begin{matrix} F_{i} & {i = {{0\mspace{14mu} \ldots \mspace{20mu} t} - 1}} \\ {{rem}\left( {F_{i},2^{L - 1}} \right)} & {i = {t\mspace{14mu} \ldots \mspace{14mu} n}} \end{matrix} \right.$

where {circumflex over (F)}_(i) is the output of Demapper A and F_(i) is the input. Demapper A′ (400) only handles the last n′ symbols and recovers from them only the redundancy bits produced by the BCH encoder by computing b; =└Y_(i)/(L/2)┘ for i=t=t . . . n−1. The output of Demapper A′ (400) is a sequence of n′ bits which are decoded by the binary BCH decoder (410) which produces k′ bits. These bits are then mapped back into w symbols over GF(p) by the Mapper (420) which performs the same task as the Mapper (220) in the “syndrome separate” decoder of FIG. 3.

In parallel, the output of Demapper A (430) flows into the Syndrome computation unit (440) which performs the same task as the Syndrome computation unit (340) in the encoder. The output of Mapper (420) are the “accurate” syndrome symbols while the output of the syndrome computation unit (440) is a result of errors symbols. The difference between these syndromes (symbol by symbol) is the syndrome due to the errors alone. This difference is computed by the Subtract unit (450). Unit 460 receives the output of 450 and Demapper A, and recovers the accurate symbols. Any suitable conventional method can be used to effect the recovery, such as that described in steps 2-5 on page 311 Section 10.4 (“Decoding alternant codes in the Lee metric”), in reference [2]. The output of 460 flows into the Demapper B (470) which performs the reverse operation of Mapper A (300) for symbols 0 . . . t−1 and Mapper A′ (310) for symbols t . . . n−1. The output is the reconstructed input stream.

Parameter Determination in accordance with certain embodiments of the present invention is now described. There is a degree of freedom lying, again, in the tradeoff between w which determines the k′ and the ability to correct the data symbols and n′−k′ which is the redundancy allotted for the BCH code and determines the ability to correct errors in the “accurate” syndrome. A decoding error may occur if either one of the following events occurs:

-   -   1. An error occurs in the decoding of “accurate” Syndrome (410).         i.e., there were more than └(n′−k′)/┌log₂ n′┐┘ errors in the         (n−t) symbols allocated to store the redundancy. The probability         of bit error is P_(cross)/(L/2).     -   2. An error occurs in the decoding of the data symbols using the         Lee metric decoder (460) indicating that there were w or more         errors in one of the n symbols.         -   The probability of any of these events may be upper-bounded             by

$P_{err} \leq {{\sum\limits_{i = {{\lfloor{{({n^{\prime} - k^{\prime}})}/{\lceil{\log_{2}n^{\prime}}\rceil}}\rfloor} + 1}}^{n^{\prime}}{\frac{n^{\prime}!}{{i!}{\left( {n^{\prime} - i} \right)!}} \left( {\frac{2}{L}p_{cross}} \right)^{i} \left( {1 - {\frac{2}{L}P_{cross}}} \right)^{n^{\prime} - i}}} + {\quad {\underset{i = w}{\overset{n}{{\quad\quad}\sum}}{\quad{\frac{n!}{{i!}{\left( {n - i} \right)!}} \left( {\frac{{2L} - 2}{L}p_{cross}} \right)^{i}\left( {1 - {\frac{{2L} - 2}{L}P_{cross}}} \right)^{n - i}}}}}}$

-   -   -   Thus, by enumerating over w, a value may be selected which             brings the above probability to a minimum.         -   The improvement in the above expression here compared with             that obtained for the “syndrome separate” code is in the             first summand which now includes a small probability:             P_(cross)/(L/2). This probability may be compared with the             probability appearing for the “syndrome separate” code after             normalizing with the number of bits per symbol; the             comparison being

$2{P_{cross}/L}\mspace{14mu} {vis}\mspace{14mu} a\mspace{14mu} {vis}\mspace{14mu} 2{{P_{cross}/L} \cdot \frac{L - 1}{\log_{2}L} \cdot}$

The “syndrome separate & shortened” code, characterized by a separately encoded shortened Syndrome, is now described. The “syndrome separate & shortened” code embodiment improves the “syndrome separate” code embodiment at the expense of adding w² multiplications over GF(p). The following symbols are used to describe the “syndrome separate & shortened” code:

k—number of data bits to be encoded

n—number of symbols in encoded word

L—number of levels

r—number of bits to be encapsulated by Mapper A (500)

t—number of symbols produced by Mapper A (500)

p—the smallest prime larger than t+w

D_(i) (i=0 . . . t−1)—output symbols of Mapper A (500) comprising numbers in GF(p) with values between 0 and L−1.

w—number of symbols produced by the Syndrome Computation block (510)

S_(j) (j=0 . . . w−1)—output symbols of the Syndrome computation block (510) comprising numbers in GF(p).

Z_(j) (j=0 . . . w−1)—output symbols of block 520 comprising numbers in GF(p).

V_(j) (j=0 . . . w−1) and T_(j) (j=0 . . . w−1)—output symbols of block 530 comprising numbers in GF(p).

α—a non-zero element of GF(p) (i.e. a number between 1 and p−1).

k′—the number of bits mapped by the Demapper unit (540) following the mapping of the w symbols outputted from the Roundup unit (530).

n′—number of bits at the output of the BCH encoder unit (550).

r′—number of symbols encapsulated in unison (in parallel) by the Demapper unit (540).

FIG. 6 illustrates an encoder of the “syndrome separate & shortened” code which is similar to the “syndrome separate” encoder of FIG. 2 but includes 2 additional units: xG⁻¹ unit 520 and roundup unit 530. The operations of all other blocks substantially resemble the operations of their counterparts in FIG. 2, respectively. For example, as in the “syndrome separate” code embodiment, data in the form of a bit sequence flows into Mapper A (500) and then to the syndrome computation unit (510). Both units, 500 and 510, operate substantially as do their counterparts in the “syndrome separate” code encoder of FIG. 2, however the w-symbol output of the Syndrome computation unit (510) flows into a matrix multiplier xG⁻¹ (520) which multiplies the syndrome (as computed before) by the following matrix G⁻¹:

${G^{- 1} = \begin{pmatrix} \alpha^{t \cdot 0} & \alpha^{{({t + 1})} \cdot 0} & \alpha^{{({t + 2})} \cdot 0} & \cdots & \alpha^{{({t + w - 1})} \cdot 0} \\ \alpha^{t \cdot 1} & \alpha^{{({t + 1})} \cdot 1} & \alpha^{{({t + 2})} \cdot 1} & \; & \; \\ \alpha^{t \cdot 2} & \alpha^{{({t + 1})} \cdot 2} & \alpha^{{({t + 2})} \cdot 2} & \; & \; \\ \vdots & \; & \; & \ddots & \; \\ \alpha^{t \cdot {({w - 1})}} & \; & \; & \; & \alpha^{{({t + w - 1})} \cdot {({w - 1})}} \end{pmatrix}^{- 1}},$

where α is the primitive element in GF(p) used in the computation of the syndrome. The multiplication operation is defined as follows:

${\begin{pmatrix} Z_{0} \\ Z_{1} \\ \vdots \\ Z_{w - 1} \end{pmatrix} = {G^{- 1}\begin{pmatrix} S_{0} \\ S_{1} \\ \vdots \\ S_{w - 1} \end{pmatrix}}},$

where Z_(i) are the outputs of the matrix multiplication unit.

The output of the matrix multiplier flows into the Roundup unit 530 which adds a number T_(i) between 0 and L−1 to each of the elements Z_(i) such that V_(i)+T₁ modulo p is divisible by L. The symbols T_(i), which take only values between 0 and L−1, are outputted to the Selector unit (580) which appends these symbols to the end of the t symbols holding the data. The symbols V_(i) flow to the Demapper unit (540). V_(i) typically only have ┌p/L┐ possible values, all divisible by L.

The Demapper unit (540) operates similarly to the Demapper (120) of the “syndrome separate” code encoder of FIG. 2, however before performing the encapsulation, the symbols are divided by L and in the encapsulation process, the parameter p is exchanged with ┌p/L┐. This yields a more compact presentation of the syndrome and diminishes the BCH code's requirements, thus allowing a tradeoff between w and n′−k′ in the computation of the frame error rate to weigh in favor of w. The operations of the other units in FIG. 6 are similar to those of their counterparts in the “syndrome separate” encoder of FIG. 2. The end result is a codeword as shown in FIG. 17.

The codeword of FIG. 17 may include three portions. The first portion (2200) is simply a mapping of the data sequence into L levels. The second portion (2210) includes W L-level symbols which define a portion of the syndrome characterized in that the overall syndrome of the data symbols along with these W symbols has a significantly smaller set of possibilities. The third portion (2220) includes some of the encoded syndrome (only the portion thereof which was to be defined) and is used as redundancy for purpose of error correction of the information in the first two portions 2200 and 2210. The third portion 2220 is also mapped into L levels and comprises:

a first portion (2230) including the mapping of the total syndrome (computed from portion 2200 and 2210) mapped into bits and then mapped to L levels; and

a second portion (2240) including the mapping to L levels of the redundancy as so computed by the BCH encoder of the portion (2230).

FIG. 7 illustrates a “syndrome separate & shortened” decoder which is similar to the “syndrome separate” decoder of FIG. 3, however, a matrix multiplier unit xG (640) is provided which multiplies the W-symbol output of the Mapper unit (630) by the following matrix G:

$G^{- 1} = {\begin{pmatrix} \alpha^{t \cdot 0} & \alpha^{{({t + 1})} \cdot 0} & \alpha^{{({t + 2})} \cdot 0} & \cdots & \alpha^{{({t + w - 1})} \cdot 0} \\ \alpha^{t \cdot 1} & \alpha^{{({t + 1})} \cdot 1} & \alpha^{{({t + 2})} \cdot 1} & \; & \; \\ \alpha^{t \cdot 2} & \alpha^{{({t + 1})} \cdot 2} & \alpha^{{({t + 2})} \cdot 2} & \; & \; \\ \vdots & \; & \; & \ddots & \; \\ \alpha^{t \cdot {({w - 1})}} & \; & \; & \; & \alpha^{{({t + w - 1})} \cdot {({w - 1})}} \end{pmatrix} \cdot}$

The Mapper unit (630) is similar to Mapper unit (220) in the “syndrome separate” decoder of FIG. 2, however, the parameter p is replaced with ┌p/L┐ and the outputs are multiplied by L. Also, the syndrome computation unit (610) operates over t+w elements whereas its counterpart in the “syndrome separate” decoder of FIG. 2 operates over t elements. The remaining units in the “syndrome separate & shortened” decoder of FIG. 7 can be generally identical to their counterparts in the “syndrome separate” code decoder of FIG. 2.

Parameter Determination for the “syndrome separate & shortened” code embodiment of FIGS. 6 and 7 in accordance with certain embodiments of the present invention is now described. Computations for the “syndrome separate & shortened” code embodiment differ from those performed for the “syndrome separate” code to accommodate for the fact that a portion of the redundancy is passed to the Lee decoder and that k′ and n′ are now smaller. A decoding error may occur if either one of the following occurs:

-   -   1. An error occurs in the decoding of “accurate” Syndrome (610),         e.g. there are more than └(n′−k′)/┌log₂ n′┐┘ errors in the         (n−t−w) symbols allocated to store the redundancy.     -   2. An error occurs in the decoding of the data symbols using the         Lee metric decoder (660), e.g. there are w or more errors in the         first t+w symbols.

The probability of either of these events may be bounded from above by

$P_{err} \leq {\sum\limits_{i = {{\lfloor{{({n^{\prime} - k^{\prime}})}/{\lceil{\log_{2}n^{\prime}}\rceil}}\rfloor} + 1}}^{n - t - w}{\frac{\left( {n - t - w} \right)!}{{i!}{\left( {n - t - w - i} \right)!}} \left( {\frac{{2L} - 2}{L}p_{cross}} \right)^{i}{\quad {\left( {1 - {\frac{{2L} - 2}{L}P_{cross}}} \right)^{n - t - i} + {\sum\limits_{i = w}^{t + w}{\frac{\left( {t + w} \right)!}{{i!}{\left( {t + w - i} \right)!}} \left( {\frac{{2L} - 2}{L}p_{cross}} \right)^{i}\left( {1 - {\frac{{2L} - 2}{L}P_{cross}}} \right)^{t + w - i}}}}}}}$

Thus, by enumerating over w, a value may be selected which reduces the above probability, typically to a minimum.

The “syndrome separate & shortened, redundancy & data mixed” code, characterized by mixed data and an encoded shortened Syndrome, is now described. This code improves the “syndrome separate, redundancy & data mixed” code at the cost of adding w² multiplications over GF(p). The following symbols are used in the following description of the syndrome separate & shortened, redundancy & data mixed” code:

k—number of data bits to be encoded

n—number of symbols in encoded word

L—number of levels

t—number of symbols produced by Mapper A (700).

p—the smallest prime larger than n

D_(i) (i=0 . . . n−1)—Combined symbol output of Mapper A (700) and A′ (710) Comprising numbers in GF(p) with values between 0 and L−1.

w—number of symbols produced by the Syndrome Computation block (740)

S_(j) (j=0 . . . w−1)—output symbols of the Syndrome computation block (740) comprising numbers in GF(p).

Z_(j) (j=0 . . . w−1)—output symbols of block 750 comprising numbers in GF(p).

V_(j) (j=0 . . . w−1) and T_(j) (j=0 . . . w−1)—output symbols of block 760 comprising numbers in GF(p).

k′—the number of bits mapped by the Demapper unit (780) following the mapping of the w symbols outputted by the Syndrome Computation block (740).

n′—number of bits at the output of the BCH encoder unit (790).

b_(i)—bit i (=0 . . . n′−1) of the output sequence of the BCH encoder unit (790).

Y_(i)—the symbols (i=0 . . . n−1) at the output of the Mapper B (800) unit

FIG. 8 illustrates a “syndrome separate & shortened, redundancy & data mixed” encoder. A difference between this encoder and the encoder of the “syndrome separate, redundancy & data mixed” code is that w additional symbols with values between 0 and L−1 are appended at the encoder of codeword 2, allowing the sequence of bits (b_(i), i=0 . . . n′−1) used to encode the Syndrome to be shortened at the expense of adding w elements to the Lee decoding procedure. This guarantees a new tradeoff between w and the size of the redundancy of the BCH code e.g. (n′−k′ bits). The composition of the codeword is shown in FIG. 14. The mid-section 1410 comprises both data bits and encoded syndrome bits (what is left of it following the use of the additional w symbols appended to the end of the codeword) as shown in FIG. 16 in portions 2120 and 2130.

Mapper A (700), Mapper B (710), Selector (720) and the syndrome Computation unit (740) may be generally identical to their counterparts in the “syndrome separate, redundancy & data mixed” encoder of FIG. 4 namely units 300, 310, 320 and 340 respectively. It is appreciated that in this embodiment, t=n−n′−w.

Downstream of the syndrome computation unit (740) are a matrix multiplier xG⁻¹ (750) and a roundup unit (760) which may be generally similar to their counterparts in the “syndrome separate & shortened” encoder of FIG. 6 namely units 520 and 530 respectively. The matrix multiplier xG⁻¹ (750) typically computes the following:

$\begin{pmatrix} Z_{0} \\ Z_{1} \\ \vdots \\ Z_{w - 1} \end{pmatrix} = {\begin{pmatrix} \alpha^{{({t + n^{\prime}})} \cdot 0} & \alpha^{{({t + n^{\prime} + 1})} \cdot 0} & \alpha^{{({t + n^{\prime} + 2})} \cdot 0} & \cdots & \alpha^{{({t + n^{\prime} + w - 1})} \cdot 0} \\ \alpha^{{({t + n^{\prime}})} \cdot 1} & \alpha^{{({t + n^{\prime} + 1})} \cdot 1} & \alpha^{{({t + n^{\prime} + 2})} \cdot 1} & \; & \; \\ \alpha^{{({t + n^{\prime}})} \cdot 2} & \alpha^{{({t + n^{\prime} + 1})} \cdot 2} & \alpha^{{({t + n^{\prime} + 2})} \cdot 2} & \; & \; \\ \vdots & \; & \; & \ddots & \; \\ \alpha^{{({t + n^{\prime}})} \cdot {({w - 1})}} & \; & \; & \; & \alpha^{{({t + n^{\prime} + w - 1})} \cdot {({w - 1})}} \end{pmatrix}^{- 1}\begin{pmatrix} S_{0} \\ S_{1} \\ \vdots \\ S_{w - 1} \end{pmatrix}}$

where Z_(i) are the outputs of the matrix multiplication unit.

The Demapper unit (780) may be similar to Demapper (350) of the “syndrome separate, redundancy & data mixed” encoder of FIG. 4, however typically, before demapper 780 performs encapsulation, the symbols are divided by L and in the encapsulation process, the parameter p is exchanged with ┌p/L┐, all in contrast to demapper 350, to provide a more compact presentation of the syndrome and diminish the requirements from the BCH, thereby allowing the tradeoff between w and n′−k′ in the computation of the frame error rate to weigh in favor of w. The operation of the other units may be similar to that of their counterparts in the “syndrome separate, redundancy & data mixed” encoder of FIG. 4 except that the Mapper 800, unlike its counterpart, mapper 370 in the “syndrome separate, redundancy & data mixed” code embodiment, effects mixing of the bits b₁ from the BCH encoder 790 and the channel symbols for symbols t . . . t+n′−1 instead of for symbols n−n′ . . . n−1 where t=n−n′−w, rather than: t=n−n′.

FIG. 9 illustrates a “syndrome separate & shortened, redundancy & data mixed” decoder which is similar to the “syndrome separate, redundancy & data mixed” decoder of FIG. 5, however, in FIG. 9, a matrix multiplier unit xG (930) is provided which receives the output of w symbols of the Mapper unit (920) and multiplies it by the following matrix G:

$G = {\begin{pmatrix} \alpha^{{({t + n^{\prime}})} \cdot 0} & \alpha^{{({t + n^{\prime} + 1})} \cdot 0} & \alpha^{{({t + n^{\prime} + 2})} \cdot 0} & \cdots & \alpha^{{({t + n^{\prime} + w - 1})} \cdot 0} \\ \alpha^{{({t + n^{\prime}})} \cdot 1} & \alpha^{{({t + n^{\prime} + 1})} \cdot 1} & \alpha^{{({t + n^{\prime} + 2})} \cdot 1} & \; & \; \\ \alpha^{{({t + n^{\prime}})} \cdot 2} & \alpha^{{({t + n^{\prime} + 1})} \cdot 2} & \alpha^{{({t + n^{\prime} + 2})} \cdot 2} & \; & \; \\ \vdots & \; & \; & \ddots & \; \\ \alpha^{{({t + n^{\prime}})} \cdot {({w - 1})}} & \; & \; & \; & \alpha^{{({t + n^{\prime} + w - 1})} \cdot {({w - 1})}} \end{pmatrix} \cdot}$

Demappers A′ (900) and A (940) may be similar to Demappers A′ (400) and A (430) in the “syndrome separate, redundancy & data mixed” decoder of FIG. 5, except that demixing is effected for symbols t . . . t+n′−1 instead of for symbols n−n′ . . . n−1 where t=n−n′−w rather than t=n−n′. The Mapper unit (920) may be generally similar to the Mapper unit (420) in the “syndrome separate” decoder of FIG. 3 however during de-encapsulation, the parameter p is replaced with ┌p/L┐ and the outputs are multiplied by L. In the “syndrome separate & shortened, redundancy & data mixed” decoder of FIG. 9, as opposed to its FIG. 5 counterpart for the “syndrome separate, redundancy & data mixed” code, the syndrome computation unit (950) operates over n=t+n′+w elements instead of t elements. The remaining units of FIG. 9 may be generally similar to their “syndrome separate, redundancy & data mixed” code counterparts in the embodiment of FIG. 5.

Parameter Determination in accordance with certain embodiments of the present invention is now described. A decoding error may occur if either one of the following events occurs:

-   -   1. An error occurs in the decoding of “accurate” Syndrome (910),         e.g. there are more than └(n′−k′)/┌log₂ n′┐┘ errors in the         (n′=n−t−w) symbols allocated to store the redundancy. Now, the         probability of bit error is given by P_(cross)/(L/2).     -   2. An error occurs in the decoding of the data symbols using the         Lee metric decoder (970), e.g. there were w or more errors in n         symbols.         -   The probability of any of these events may be bounded from             above by

${{P_{err} \leq {{\sum\limits_{i = {{\lfloor{{({n^{\prime} - k^{\prime}})}/{\lceil{\log_{2}n^{\prime}}\rceil}}\rfloor} + 1}}^{n^{\prime}}{\frac{n^{\prime}!}{{i!}{\left( {n^{\prime} - i} \right)!}} \left( {\frac{2}{L}p_{cross}} \right)^{i} \left( {1 - {\frac{2}{L}P_{cross}}} \right)^{n^{\prime} - i}}} +}}\quad}{\quad {\underset{i = w}{\overset{n}{\quad{\quad\quad}{\quad\quad}\sum}} \frac{n!}{{i!}{\left( {n - i} \right)!}} \left( {\frac{{2L} - 2}{L}p_{cross}} \right)^{i}{\quad{\quad\quad}\quad}\left( {1 - {\frac{{2L} - 2}{L}P_{cross}}} \right)^{n - i}}}$

-   -   -   Thus, by enumerating over w, a value may be selected which             reduces the above probability, e.g. to a minimum.

A numerical example for use of “syndrome separate & shortened, redundancy & data mixed” code is now described. In the following example, the number of levels is L=16, the code length is n=4352, the number of data bits to be encoded is k=16384, the number of symbols produced by Mapper A is t=5462, the prime number of the field is p=4357. the primitive element is α=2, the syndrome size is w=76, the number of bits encapsulated by mapper r is 122 (encapsulating 15 symbols with ┌p/L┐ values each), the bit sequence to be encoded by the BCH is k′=619 bits long, the Bit sequence produced by the BCH is n′=719 bits long, the field over which the binary BCH was constructed is GF(2¹⁰) and the prime polynomial constructing it is X¹⁰+X³+1. A code with the above parameters can handle p_(cross)=0.0036 and obtain a frame error rate of approximately 5e-13. The advantage of the above code, in comparison with other conventional coding schemes, is immediately apparent. The above cross over probability induces an un-coded bit error rate of 0.001688 if Gray coding is used; and it is appreciated that the code above did not actually require Gray coding. A frame error of 5E-13 would be obtained by an equivalent code which can correct up to 75 errors. However, using a conventional binary BCH code with the same number of spare cells (1024 bits) it is only possible to correct 68 errors.

Use of Lee distance based codes rather than Hamming distance based codes is a particular advantage in flash memory devices constructed and operative in accordance with certain embodiments of the present invention because if gray mapping is being used in a flash memory device, errors almost always involve a symbol being confounded with a neighboring symbol in the mapping scheme rather than with a distant symbol in the mapping scheme, such that use of Lee distance based code may give better error correction functionality per unit of redundancy or less redundancy for a given level of error correction functionality adequacy.

It is appreciated that software components of the present invention including programs and data may, if desired, be implemented in ROM (read only memory) form including CD-ROMs, EPROMs and EEPROMs, or may be stored in any other suitable computer-readable medium such as but not limited to disks of various kinds, cards of various kinds and RAMs. Components described herein as software may, alternatively, be implemented wholly or partly in hardware, if desired, using conventional techniques.

Included in the scope of the present invention, inter alia, are electromagnetic signals carrying computer-readable instructions for performing any or all of the steps of any of the methods shown and described herein, in any suitable order; machine-readable instructions for performing any or all of the steps of any of the methods shown and described herein, in any suitable order; program storage devices readable by machine, tangibly embodying a program of instructions executable by the machine to perform any or all of the steps of any of the methods shown and described herein, in any suitable order; a computer program product comprising a computer useable medium having computer readable program code having embodied therein, and/or including computer readable program code for performing, any or all of the steps of any of the methods shown and described herein, in any suitable order; any technical effects brought about by any or all of the steps of any of the methods shown and described herein, when performed in any suitable order; any suitable apparatus or device or combination of such, programmed to perform, alone or in combination, any or all of the steps of any of the methods shown and described herein, in any suitable order; information storage devices or physical records, such as disks or hard drives, causing a computer or other device to be configured so as to carry out any or all of the steps of any of the methods shown and described herein, in any suitable order; a program pre-stored e.g. in memory or on an information network such as the Internet, before or after being downloaded, which embodies any or all of the steps of any of the methods shown and described herein, in any suitable order, and the method of uploading or downloading such, and a system including server/s and/or client/s for using such; and hardware which performs any or all of the steps of any of the methods shown and described herein, in any suitable order, either alone or in conjunction with software.

Certain operations are described herein as occurring in the microcontroller internal to a flash memory device. Such description is intended to include operations which may be performed by hardware which may be associated with the microcontroller such as peripheral hardware on a chip on which the microcontroller may reside. It is also appreciated that some or all of these operations, in any embodiment, may alternatively be performed by the external, host-flash memory device interface controller including operations which may be performed by hardware which may be associated with the interface controller such as peripheral hardware on a chip on which the interface controller may reside. Finally it is appreciated that the internal and external controllers may each physically reside on a single hardware device, or alternatively on several operatively associated hardware devices.

Any data described as being stored at a specific location in memory may alternatively be stored elsewhere, in conjunction with an indication of the location in memory with which the data is associated. For example, instead of storing page- or erase-sector-specific information within a specific page or erase sector, the same may be stored within the flash memory device's internal microcontroller or within a microcontroller interfacing between the flash memory device and the host, and an indication may be stored of the specific page or erase sector associated with the cells.

It is appreciated that the teachings of the present invention can, for example, be implemented by suitably modifying, or interfacing externally with, flash controlling apparatus. The flash controlling apparatus controls a flash memory array and may comprise either a controller external to the flash array or a microcontroller on-board the flash array or otherwise incorporated therewithin. Examples of flash memory arrays include Samsung's K9XXG08UXM series, Hynix' HY27UK08BGFM Series, Micron's MT29F64008TAAWP or other arrays such as but not limited to NOR or phase change memory. Examples of controllers which are external to the flash array they control include STMicroelectrocincs's ST7265×microcontroller family, STMicroelectrocincs's ST72681 microcontroller, and SMSC's USB97C242, Traspan Technologies' TS-4811, Chipsbank CBM2090/CBM1190. Example of commercial IP software for Flash file systems are: Denali's Spectra™ NAND Flash File System, Aarsan's NAND Flash Controller IP Core and Arasan's NAND Flash File System. It is appreciated that the flash controller apparatus need not be NAND-type and can alternatively, for example, be NOR-type or phase change memory-type.

-   -   It will also be understood that the system according to the         invention may be a suitably programmed computer. Likewise, the         invention contemplates a computer program being readable by a         computer for executing the method of the invention. The         invention further contemplates a machine-readable memory         tangibly embodying a program of instructions executable by the         machine for executing the method of the invention.

Flash controlling apparatus, whether external or internal to the controlled flash array, typically includes the following components: a Memory Management/File system, a NAND interface (or other flash memory array interface), a Host Interface (USB, SD or other), error correction circuitry (ECC) typically comprising an Encoder and matching decoder, and a control system managing all of the above.

The present invention may for example interface with or modify, as per any of the embodiments described herein, one, some or all of the above components and particularly with the ECC component.

Features of the present invention which are described in the context of separate embodiments may also be provided in combination in a single embodiment. Conversely, features of the invention, including method steps, which are described for brevity in the context of a single embodiment or in a certain order may be provided separately or in any suitable subcombination or in a different order. “e.g.” is used herein in the sense of a specific example which is not intended to be limiting. 

1. A method for error correction encoding of L level application data residing in a memory comprising L level Multi-level cells (MLCs) including at least some Multi-level cells (MLCs) in which the application data is residing and at least some Multi-level cells (MLCs) which are at least partly available to accept data other than the application data, the method comprising: encoding the L level application data over a prime field thereby to generate non-binary redundancy data; binarizing at least some of said non-binary redundancy data thereby to generate binarized redundancy data; effecting binary error-correction encoding of the binarized redundancy data, thereby to generate binary redundancy data; combining said binarized redundancy data and said binary redundancy data thereby to generate combined binarized/binary redundancy data; and restoring said combined binarized/binary redundancy data to L level form, thereby to generate restored L level redundancy data, and storing said restored L level redundancy data in at least some of said at least partly available L level Multi-level cells (MLCs).
 2. A method according to claim 1 and also comprising, for at least one L level MLC, utilizing less than L levels for storing at least a portion of said L level application data and utilizing remaining ones of said L levels for storing at least a portion of said combined binarized/binary redundancy data.
 3. A method according to claim 1 wherein said binarizing comprises binarizing all of said non-binary redundancy data.
 4. A method according to claim 1 wherein said binarizing comprises binarizing only some of said non-binary redundancy data thereby to define a portion of said non-binary redundancy data which is un-binarized, and wherein said method also comprises L-level transforming said un-binarized non-binary redundancy data to L-level un-binarized non-binary redundancy data.
 5. A method according to claim 4 wherein said binarizing and said L-level transforming are effected by a single transform function.
 6. A method according to claim 4 and also comprising storing said L-level un-binarized non-binary redundancy data in said L level Multi-level cells (MLCs).
 7. A method according to claim 1 and wherein said encoding over a prime field comprises Reed-Solomon encoding over a prime field.
 8. A method according to claim 1 wherein said combining comprises concatenating said binarized redundancy data and said binary redundancy data thereby to generate concatenated binarized/binary redundancy data.
 9. A method according to claim 1 wherein said binary error-correction encoding comprises BCH encoding of the binarized redundancy data, thereby to generate BCH-encoded redundancy data.
 10. A method according to claim 1 wherein said at least some Multi-level cells (MLCs) which are at least partly available to accept data other than said application data comprise entirely available Multi-level cells (MLCs) in which no L level application data is residing, and wherein said storing comprises storing said restored L level redundancy data in at least some of said entirely available L level Multi-level cells (MLCs).
 11. A method for error correction decoding of at least restored L level redundancy data residing in a memory comprising L level Multi-level cells (MLCs) including at least some Multi-level cells (MLCs) in which possibly erroneous L-level application data resides and at least some Multi-level cells (MLCs) which store at least said restored L level redundancy data, the method comprising: binarizing said at least restored L level redundancy data, thereby to generate binarized restored L level redundancy data; deriving binary redundancy data from said binarized restored L level redundancy data; effecting binary error-correction decoding of the binary redundancy data, thereby to generate binarized redundancy data; transforming said binarized redundancy data to generate non-binary redundancy data; and decoding said non-binary redundancy data and said possibly erroneous L-level application data over a prime field, thereby to generate decoded L level application data.
 12. A method according to claim 2 wherein said binarizing comprises binarizing only some of said non-binary redundancy data thereby to define a portion of said non-binary redundancy data which is un-binarized, and wherein said method also comprises L-level transforming said un-binarized non-binary redundancy data to L-level un-binarized non-binary redundancy data.
 13. Apparatus for error correction encoding of L level application data residing in a memory comprising L level Multi-level cells (MLCs) including at least some Multi-level cells (MLCs) in which said application data is residing and at least some Multi-level cells (MLCs) which are at least partly available to accept data other than said application data, the apparatus comprising: prime-field encoding apparatus operative to encode the L level application data over a prime field thereby to generate non-binary redundancy data; binarization apparatus operative to binarize at least some of said non-binary redundancy data thereby to generate binarized redundancy data; binary ECC apparatus operative to effect binary error-correction encoding of the binarized redundancy data, thereby to generate binary redundancy data; and data combination apparatus operative to combine said binarized redundancy data and said binary redundancy data thereby to generate combined binarized/binary redundancy data; and L-level restoration apparatus operative to restore said combined binarized/binary redundancy data to L level form, thereby to generate restored L level redundancy data, and storing said restored L level redundancy data in at least some of said at least partly available L level Multi-level cells (MLCs).
 14. A method for operating a flash device, said method comprising: using Lee distance based codes in said flash device; thereby increasing the number of errors that can be corrected for a given number of redundancy cells compared with Hamming distance based codes.
 15. A method for operating a flash device, said method comprising: providing a Lee code associated with a first group of symbols; and programming data in the flash device using a second group of symbols, said second group being a sub group of the first group so as to allow extending the number of errors that can be corrected for a given number of redundancy cells compared with Hamming distance based codes.
 16. The method of claim 15 wherein said first data stream is associated with a first group of symbols and said redundancy data stream is associated with a second group of symbols, said second group being a sub group of the first group.
 17. A decoding system comprising: a Lee metric-based decoder operative to decode multi-level physical media.
 18. A method for error correction comprising: encoding data capable of being decoded, thereby to effect error correction, said encoding comprising using a separate encoder to store a Syndrome computation to be used during said decoding.
 19. A method for error correction comprising: encoding data capable of being decoded, thereby to effect error correction, said encoding comprising: encoding a syndrome giving rise to encoded syndrome; and encapsulating and mapping the encoded syndrome into designated media cells.
 20. A method for error correction comprising: encoding data capable of being decoded, thereby to effect error correction, said encoding comprising: encoding a syndrome; and reducing error probability in the encoded Syndrome by encapsulating and mapping the encoded Syndrome mixed with data bits into designated media cells.
 21. A storage system comprising: a flash memory cell array; a Lee distance based encoder associated with a first group of symbols; and a writing module for programming data in at least one cell of the cell array using a second group of symbols, said second group being a sub group of the first group so as to allow extending the number of errors that can be corrected for a given number of redundancy cells compared with Hamming distance based codes.
 22. A system according to claim 17 wherein said multi-level physical media includes media having less levels than symbol values.
 23. A program storage device readable by machine, tangibly embodying a program of instructions executable by the machine to perform method steps for error correction encoding of L level application data residing in a memory comprising L level Multi-level cells (MLCs) including at least some Multi-level cells (MLCs) in which the application data is residing and at least some Multi-level cells (MLCs) which are at least partly available to accept data other than the application data, the method comprising: encoding the L level application data over a prime field thereby to generate non-binary redundancy data; Binarizing at least some of said non-binary redundancy data thereby to generate binarized redundancy data; Effecting binary error-correction encoding of the binarized redundancy data, thereby to generate binary redundancy data; Combining said binarized redundancy data and said binary redundancy data thereby to generate combined binarized/binary redundancy data; and Restoring said combined binarized/binary redundancy data to L level form, thereby to generate restored L level redundancy data, and storing said restored L level redundancy data in at least some of said at least partly available L level Multi-level cells (MLCs).
 24. A computer program product comprising a computer useable medium having computer readable program code embodied therein for error correction encoding of L level application data residing in a memory comprising L level Multi-level cells (MLCs) including at least some Multi-level cells (MLCs) in which the application data is residing and at least some Multi-level cells (MLCs) which are at least partly available to accept data other than the application data, the computer program product comprising: computer readable program code for causing the computer to encode the L level application data over a prime field thereby to generate non-binary redundancy data; computer readable program code for causing the computer to binarize at least some of said non-binary redundancy data thereby to generate binarized redundancy data; computer readable program code for causing the computer to effect binary error-correction encoding of the binarized redundancy data, thereby to generate binary redundancy data; computer readable program code for causing the computer to combine said binarized redundancy data and said binary redundancy data thereby to generate combined binarized/binary redundancy data; and computer readable program code for causing the computer to restore said combined binarized/binary redundancy data to L level form, thereby to generate restored L level redundancy data, and storing said restored L level redundancy data in at least some of said at least partly available L level Multi-level cells (MLCs).
 25. A storage system comprising: a flash memory cell array; and a Lee distance based encoder; wherein said Lee distance based encoder is used for error correction encoding thereby increasing the number of errors that can be corrected for a given number of redundancy cells compared with Hamming distance based codes. 